package com.hello.system.domain;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.hello.common.core.annotation.Excel;
import com.hello.common.core.web.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 用户密码安全存储对象 user_passwords
 * 
 * @author hello
 * @date 2025-10-29
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class UserPasswords extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 密码记录ID（主键） */
    private Long id;

    /** 用户ID（关联users表，唯一） */
    @Excel(name = "用户ID", readConverterExp = "关=联users表，唯一")
    private Long userid;

    /** 密码哈希值（加密后的密码） */
    @Excel(name = "密码哈希值", readConverterExp = "加=密后的密码")
    private String passwordHash;

    /** 密码盐值（用于加密的随机字符串） */
    @Excel(name = "密码盐值", readConverterExp = "用=于加密的随机字符串")
    private String salt;

    /** 加密算法（默认pbkdf2_sha256） */
    @Excel(name = "加密算法", readConverterExp = "默=认pbkdf2_sha256")
    private String algorithm;

    /** 哈希迭代次数（增加破解难度） */
    @Excel(name = "哈希迭代次数", readConverterExp = "增=加破解难度")
    private Long iterations;

    /** 密码创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "密码创建时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date createdAt;

    /** 记录更新时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "记录更新时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date updatedAt;

    /** 最后一次修改密码时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "最后一次修改密码时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date lastChanged;

    public void setId(Long id) 
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }
    public void setUserid(Long userid) 
    {
        this.userid = userid;
    }

    public Long getUserid() 
    {
        return userid;
    }
    public void setPasswordHash(String passwordHash) 
    {
        this.passwordHash = passwordHash;
    }

    public String getPasswordHash() 
    {
        return passwordHash;
    }
    public void setSalt(String salt) 
    {
        this.salt = salt;
    }

    public String getSalt() 
    {
        return salt;
    }
    public void setAlgorithm(String algorithm) 
    {
        this.algorithm = algorithm;
    }

    public String getAlgorithm() 
    {
        return algorithm;
    }
    public void setIterations(Long iterations) 
    {
        this.iterations = iterations;
    }

    public Long getIterations() 
    {
        return iterations;
    }
    public void setCreatedAt(Date createdAt) 
    {
        this.createdAt = createdAt;
    }

    public Date getCreatedAt() 
    {
        return createdAt;
    }
    public void setUpdatedAt(Date updatedAt) 
    {
        this.updatedAt = updatedAt;
    }

    public Date getUpdatedAt() 
    {
        return updatedAt;
    }
    public void setLastChanged(Date lastChanged) 
    {
        this.lastChanged = lastChanged;
    }

    public Date getLastChanged() 
    {
        return lastChanged;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("userid", getUserid())
            .append("passwordHash", getPasswordHash())
            .append("salt", getSalt())
            .append("algorithm", getAlgorithm())
            .append("iterations", getIterations())
            .append("createdAt", getCreatedAt())
            .append("updatedAt", getUpdatedAt())
            .append("lastChanged", getLastChanged())
            .toString();
    }
}
